package com.bezdelnick.forum.web.component;

import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.MarkupStream;
import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;

/**
 * Created by IntelliJ IDEA.
 * User: Bezdelnick
 * Date: 17.07.12
 * Time: 23:44
 * To change this template use File | Settings | File Templates.
 */
public class LinkWithText extends Link {

    private IModel labelModel;

    public LinkWithText(String id, IModel linkModel, IModel labelModel) {
        super(id, linkModel);
        this.labelModel = labelModel;
    }

    public LinkWithText(String id, String link, String text) {
        this(id, new Model(link), new Model(text));
    }

    public void onComponentTagBody(MarkupStream markupStream, ComponentTag openTag) {
        replaceComponentTagBody(markupStream, openTag, labelModel.getObject().toString());
    }

    @Override
    public void onClick() {
        //
    }
}

